//
//  Inquire_TabelViewCell.m
//  EggSteward
//
//  Created by 王道林 on 16/9/7.
//  Copyright © 2016年 王道林. All rights reserved.
//

#import "Inquire_TabelViewCell.h"
#import "BaseLabel.h"
#import "Masonry.h"

@interface Inquire_TabelViewCell ()
@property (nonatomic, strong) BaseLabel *lableProvince;
@property (nonatomic, strong) BaseLabel *lablePrice;
@end
@implementation Inquire_TabelViewCell

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self createSubView];
    }
    return self;
}

- (void)createSubView
{
    _lableRanging = [[BaseLabel alloc] init];
    _lableRanging.text = @"排行";    
    [self.contentView addSubview:_lableRanging];
    
    _lableProvince = [[BaseLabel alloc] init];
    _lableProvince.text = @"省份";
    [self.contentView addSubview:_lableProvince];
    
    _lablePrice = [[BaseLabel alloc] init];
    _lablePrice.text = @"价格(元/斤)";
    [self.contentView addSubview:_lablePrice];
    
}

- (void)layoutSubviews
{
    [super layoutSubviews];
    [_lableRanging mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(self.contentView.mas_top);
        make.left.mas_equalTo(self.contentView.mas_left).mas_offset(25);
        make.width.mas_equalTo(self.contentView.mas_width).multipliedBy(0.333).mas_offset(-25);
        make.height.mas_equalTo(self.contentView.mas_height);
    }];
    
    [_lableProvince mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(self.contentView.mas_top);
        make.left.mas_equalTo(_lableRanging.mas_right);
        make.width.mas_equalTo(self.contentView.mas_width).multipliedBy(0.333);
        make.height.mas_equalTo(self.contentView.mas_height);
    }];

    [_lablePrice mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(self.contentView.mas_top);
        make.left.mas_equalTo(_lableProvince.mas_right);
        make.width.mas_equalTo(self.contentView.mas_width).multipliedBy(0.333);
        make.height.mas_equalTo(self.contentView.mas_height);
    }];

}

- (void)setModel:(InquireModel *)model
{
    _model = model;
    _lablePrice.text = _model.value;
    _lableProvince.text = _model.name;
}



@end
